#{include 'Application/top_head.html'/}
#{include 'Application/top_nav.html'/}

<div class="container">
<br />
<div class="pull-right" id="numLines">
<strong>Select Number of Lines to be Displayed in system.out:</strong> 
<select>
<option value="50000">50000</option>
  <option value="20000">20000</option>
  <option value="10000">10000</option>
  <option value="5000">5000</option>
  <option value="2000">2000</option>
  <option value="1000" selected="selected">1000</option>
  <option value="100">500</option>
  <option value="100">100</option>
   <option value="50">50</option>
   <option value="30">30</option>
   <option value="20">20</option>
</select>
</div>
<br />
<br />
<div class="btn-group pull-right" style="display:block">
    <button type="button" class="btn btn-primary" onClick="doAjax('system.out')">Refresh</button>
</div>
<div style="font-size:22px;font-weight:bold;" id="logType"></div><br />




<div id="systemOutData"></div>

</div>

<script>


$(document).ready(function(){
	doAjax('system.out');
});

(function($) {
	$('#numLines').change(function() {
		//doAjax('application.log');
		doAjax('system.out');
	});
	
	
	//setInterval(function() { doAjax() }, 10000);  
})(jQuery);

function doAjax(fileName) {
	var displayFileName = fileName;
	$("#logType").html("Superman System Log Tail");
	var numLines = $('#numLines option:selected').val();
	urlQuery = '/logconsoleAjax?fileName='+fileName+'&numberOfLines='+numLines ;
	
		$.ajax({
			type : "get",
			url : urlQuery,
			context : this,
			dataType: "text",
			success : function(data) {
				$("#systemOutData").html(data);
			},
			error : function(data) {

			}
		});
}

</script>